﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MachineVision.Core;
using MachineVision.Shared.Services;
using MachineVision.Shared.Services.Models;
using Prism.Commands;

namespace MachineVision.Defect.ViewModels
{
    public class DefectViewModel : NavigationViewModel
    {
        private readonly IProjectService appService;

        public DefectViewModel(IProjectService appService)
        {
            SearchCommand = new DelegateCommand<object>(Search);
            CreateCommand = new DelegateCommand(Create);
            DeleteCommand = new DelegateCommand<object>(Delete);
            this.appService = appService;
        }

        private void Delete(object obj) { }

        private async void Create()
        {
            await appService.CreateOrUpdateAsync(
                new ProjectModel()
                {
                    Name = "aaa",
                    CreateDate = DateTime.Now,
                    UpdateDate = DateTime.Now,
                }
            );
        }

        private void Search(object obj) { }

        #region Props
        public DelegateCommand<object> SearchCommand { get; set; }
        public DelegateCommand CreateCommand { get; set; }
        public DelegateCommand<object> DeleteCommand { get; set; }
        #endregion
    }
}
